<template>
<view>
<view class="modle_1_nav">
    <view v-for="(item, index) in table" :key="index" @tap="ActiveClick" :class="'modle_1_nav_modle ' + (activeIndex==index?'modle_1_nav_active':'')" :data-index="index" :style="'width:' + nav_width + '%'">{{item}}
    <view class="modle_1_nav_modle_border" v-if="activeIndex==index"></view>
    </view>
</view>
<view class="nav"></view>
<view v-for="(item, index) in orderList" :key="index" class="shop_border" v-if="activeIndex==1">
    <view class="shop_modle">
        <image class="shop_modle_img" :src="item.part_img"></image>
        <view class="shop_modle_name">{{item.part_name}}</view>
        <text class="shop_modle_daibaojia">待报价</text>
        <view class="shop_modle_orderTime">订购时间：{{item.create_time}}</view>
    </view>
    <view class="shop_modle_btmNav" style="margin-top:30rpx;">
        <view class="shop_modle_btmNav_img"></view>
    类型：{{item.part_type}}
  </view>
    <view class="shop_modle_btmNav">
        <view class="shop_modle_btmNav_img"></view>
    年份：{{item.car_year}}
  </view>
    <view class="shop_modle_btmNav">
        <view class="shop_modle_btmNav_img"></view>
    车型：{{item.car_type}}
  </view>
</view>
<view v-for="(item, index) in orderList" :key="index" class="shop_border" v-if="activeIndex==2">
    <view class="shop_modle">
        <image class="shop_modle_img" :src="item.part_img"></image>
        <view class="shop_modle_name">{{item.part_name}}</view>
        <text class="shop_modle_daibaojia">待付款</text>
        <view class="shop_modle_orderNumber">订单号：{{item.order_sn}}</view>
        <view class="shop_modle_orderTime">报价：
      <text class="shop_modle_orderbaojia">￥{{item.part_price}}</text>
        </view>
        <button @tap="goPay" class="shop_modle_btn" :data-id="item.id">去付款</button>
    </view>
    <view class="shop_modle_btmNav" style="margin-top:30rpx;">
        <view class="shop_modle_btmNav_img"></view>
    类型：{{item.part_type}}
  </view>
    <view class="shop_modle_btmNav">
        <view class="shop_modle_btmNav_img"></view>
    年份：{{item.car_year}}
  </view>
    <view class="shop_modle_btmNav">
        <view class="shop_modle_btmNav_img"></view>
    车型：{{item.car_type}}
  </view>
</view>
<view v-for="(item, index) in orderList" :key="index" class="shop_border" v-if="activeIndex==3">
    <view class="shop_modle">
        <image class="shop_modle_img" :src="item.part_img"></image>
        <view class="shop_modle_name">{{item.part_name}}</view>
        <text class="shop_modle_daibaojia">待发货</text>
        <view class="shop_modle_orderNumber">订单号：{{item.order_sn}}</view>
        <view class="shop_modle_orderTime">报价：
      <text class="shop_modle_orderbaojia">￥{{item.part_price}}</text>
        </view>
    </view>
    <view class="shop_modle_btmNav" style="margin-top:30rpx;">
        <view class="shop_modle_btmNav_img"></view>
    类型：{{item.part_type}}
  </view>
    <view class="shop_modle_btmNav">
        <view class="shop_modle_btmNav_img"></view>
    年份：{{item.car_year}}
  </view>
    <view class="shop_modle_btmNav">
        <view class="shop_modle_btmNav_img"></view>
    车型：{{item.car_type}}
  </view>
</view>
<view v-for="(item, index) in orderList" :key="index" class="shop_border" v-if="activeIndex==4">
    <view class="shop_modle">
        <image class="shop_modle_img" :src="item.part_img"></image>
        <view class="shop_modle_name">{{item.part_name}}</view>
        <text class="shop_modle_daibaojia">待发货</text>
        <view class="shop_modle_orderNumber">运单号：{{item.express_name}} / {{item.waybill_sn}}</view>
        <view class="shop_modle_orderTime">报价：
      <text class="shop_modle_orderbaojia">￥{{item.part_price}}</text>
        </view>
        <button @tap="confirmOrder" class="shop_modle_btn" :data-id="item.id">确认收货</button>
    </view>
    <view class="shop_modle_btmNav" style="margin-top:30rpx;">
        <view class="shop_modle_btmNav_img"></view>
    类型：{{item.part_type}}
  </view>
    <view class="shop_modle_btmNav">
        <view class="shop_modle_btmNav_img"></view>
    年份：{{item.car_year}}
  </view>
    <view class="shop_modle_btmNav">
        <view class="shop_modle_btmNav_img"></view>
    车型：{{item.car_type}}
  </view>
</view>
<view v-for="(item, index) in orderList" :key="index" class="shop_border" v-if="activeIndex==5">
    <view class="shop_modle">
        <image class="shop_modle_img" :src="item.part_img"></image>
        <view class="shop_modle_name">{{item.part_name}}</view>
        <text class="shop_modle_daibaojia shop_modle_wancheng">已完成</text>
        <view class="shop_modle_orderNumber">订单号：{{item.express_name}} / {{item.waybill_sn}}</view>
        <view class="shop_modle_orderTime">报价：
      <text class="shop_modle_orderbaojia">￥{{item.part_price}}</text>
        </view>
    </view>
    <view class="shop_modle_btmNav" style="margin-top:30rpx;">
        <view class="shop_modle_btmNav_img"></view>
    类型：{{item.part_type}}
  </view>
    <view class="shop_modle_btmNav">
        <view class="shop_modle_btmNav_img"></view>
    年份：{{item.car_year}}
  </view>
    <view class="shop_modle_btmNav">
        <view class="shop_modle_btmNav_img"></view>
    车型：{{item.car_type}}
  </view>
</view>
<view class="end_none" v-if="orderList.length>0&&isLast">没有更多了...</view>
<block v-if="orderList.length<=0">
    <!--<import src="/pages/data_null/index.wxml"></import>-->
    <view>
        <block data-type="template" data-is="title" data-attr="title:'暂无查看数据'">
    <view class="zanwushuju_border">
        <image class="zanwushuju_border_img" src="/static/pages/image/none_message.png"></image>
        <view class="zanwushuju_border_title">{{'暂无收藏数据'}}</view>
    </view>
</block>
    </view>
</block>
</view>
</template>

<script>
function _toConsumableArray(t) {
  if (Array.isArray(t)) {
    for (var a = 0, e = Array(t.length); a < t.length; a++) e[a] = t[a];

    return e;
  }

  return Array.from(t);
}
var app = getApp();

export default {
  data() {
    return {
      table: {
        1: "待报价",
        2: "待付款",
        3: "待发货",
        4: "待收货",
        5: "已完成"
      },
      activeIndex: 1,
      orderList: [],
      nav_width: "",
      page: 1,
      isLast: !1,
      isLoad: !1
    };
  },

  components: {},
  props: {},
  onLoad: function (t) {
    var a = t.status,
        e = Object.keys(this.table).length;
    this.setData({
      nav_width: 100 / e,
      activeIndex: 0 < a ? a : 1
    });
  },
  onReachBottom: function () {
    this.getList();
  },
  onShow: function () {
    this.setData({
      page: 1,
      isLast: !1
    }), this.getList();
  },
  methods: {
    getList: function () {
      var e = this;
      if (e.isLast) return !1;
      app.globalData.util.request({
        url: "entry/wxapp/Api",
        data: {
          m: "monai_market",
          r: "part.order.order_list",
          uid: app.globalData.getuid(),
          page: e.page,
          status: e.activeIndex
        },
        success: function (t) {
          if (1 < e.page) {
            if (0 < t.data.data.length) {
              var a = e.orderList;
              a.push.apply(a, _toConsumableArray(t.data.data)), e.setData({
                orderList: a
              });
            } else e.setData({
              isLast: !0
            });
          } else e.setData({
            orderList: t.data.data
          }), t.data.data.length < 1 && e.setData({
            isLast: !0
          });
          e.setData({
            page: e.page + 1
          });
        }
      });
    },
    ActiveClick: function (t) {
      this.setData({
        activeIndex: t.currentTarget.dataset.index,
        page: 1,
        isLast: !1
      }), this.getList();
    },
    goPay: function (t) {
      var a = app.globalData.getAttr(t, "id");
      wx.navigateTo({
        url: "/pagesA/part/pay/index?id=" + a
      });
    },
    confirmOrder: function (t) {
      var a = this,
          e = app.globalData.getAttr(t, "id");
      app.globalData.util.request({
        url: "entry/wxapp/Api",
        data: {
          m: "monai_market",
          r: "part.order.confirm_order",
          uid: app.globalData.getuid(),
          id: e
        },
        success: function (t) {
          a.setData({
            activeIndex: 5,
            page: 1,
            isLast: !1
          }), a.getList();
        }
      });
    }
  }
};
</script>
<style>
@import "./index.css";
</style>